---
title: "Untitled"
output: html_document
date: "2024-01-29"
---
############################################
Title: 3_01_Figure_1.rmd
Purpose: This code creates Figure 1.
Last updated: 25-04-2023

Input:
    - LSTA Trading volume data (See LSTA website)

Output:
    - Figure 1

##########################################


0. Setup *Set your file path here*
```{r, results="hide", include=FALSE}
#setup and load data
rm(list=ls()) 
library(tidyverse); library(readxl); library(tidylog); library(haven); library(tidyr); library(haven); library(purrr); library(stats); library(plm); library(sandwich); library(lmtest); library(stargazer); library(data.table); library(lubridate)  ; library(ggpubr)
options(scipen=999)
options(digits=6)

#Assign dplyr verbs  
select <- dplyr::select
rename <- dplyr::rename
mutate <- dplyr::mutate
filter <- dplyr::filter
arrange <- dplyr::arrange
distinct <- dplyr::distinct
group_by <- dplyr::group_by
summarise <- dplyr::summarise
lag <- dplyr::lag

#Define directories
global <- ".../2024_RFS_Replication_TOSUBMIT"


```

1. Figure 1
```{r, results="hide", include=FALSE}

#Data
Year <- c(1999,2000,2001,2002, 2003, 2004,2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023)

Trading_Volume <- c(79.1, 101.97, 117.52, 112.48, 144.57, 155.01, 176.34, 280, 519.83, 510.15, 474.01, 412.73, 409.19, 395.13, 517.28, 628.2, 591, 596, 635, 720, 742.29, 772, 780, 824, 715 )

Trading_Volume = as.data.frame(cbind(Year, Trading_Volume))


#PLot
ggplot(Trading_Volume) + 
  geom_col(aes(x = Year, y = Trading_Volume), size = 1, color = "darkblue", fill = "white") +
  #geom_col(aes(x = Year, y = Trading_Volume), size = 1, color = "darkblue", fill = "white") +
  #scale_y_continuous(sec.axis = sec_axis(~., name = "Loan Amount (USD bn)")) + 
  theme_bw( ) +
  ylab("Loan Amount (USD Bn)") +
  xlab("")+
  theme(text = element_text(size=8), legend.position=c(0.9,0.9)) +
  #ggtitle("US Annual Secondary Trading Volume")+
  theme(strip.text.x = element_text(size=10),
          strip.text.y = element_text(size=10),
          strip.background = element_rect(colour="white", fill="white")) +
  theme(axis.text=element_text(size=10)) + 
  theme(axis.title.x = element_text(size = 10)) +
  theme(axis.title.y = element_text(size = 10)) +
  theme(plot.title = element_text(color="black", size=10, face = "bold")) +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))


```
